<template>
  <div class="tab-control">
    <div v-for="(item,index) in title" class="tab-control-item " :class="{active:index==currentIndex}"
    @click="currentIndexClick(index)" >
      <span>{{item}}</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "TabControl",
    props: {
      title: {
        type: Array,
        default: ['流行','帅气','漂亮']
      }
    },
    data(){
      return{
        currentIndex: 0
      }
    },
    methods:{
      currentIndexClick(index){
        this.currentIndex=index
        this.$emit("clickActive",index)
      }
    }
  }
</script>

<style scoped>
.tab-control{
  display: flex;
  text-align: center;
  font-size: 18px;
  background-color: #f6f6f6;
  line-height: 44px;
  height: 44px;
  color:#ff253a;
}
.tab-control-item{
    flex: 1;

  }
.active span{
  padding-bottom: 5px;
  border-bottom: #ff8198 solid 3px;
}
</style>